A passive optical network (PON) technology is a point to multi-point optical fiber transmission and access technology. In a PON system, the transmission from an optical line terminal (OLT) to an optical network unit/optical network terminal (ONU/ONT) is in a downlink direction, which utilizes a time division multiplex (TDM) technology, and the transmission from an ONU/ONT to an OLT is in an uplink direction, which utilizes a time division multiple access (TDMA) technology. In a whole network, clocks are categorized into a master clock (MC) and a slave clock (SC) according to communication relationships. Usually, a clock with optimal stability, accuracy, and definitiveness in a network is the MC, and another clock or a plurality of other clocks that needs to be synchronized with the MC is the SC. In order to ensure time synchronization for all equipment in the PON system, it needs to be ensured that the MC and SC have the same time.
In order to ensure that the equipment has the same time, in the prior art, a time synchronization method in a PON is provided. Messages sent in the method are described in the Precision Time Protocol (PTP). As shown in FIG. 1, the method includes the following steps.
In Step 11, an MC sends a PTP_SYNC_MESSAGE and a PTP_FOLLOWUP_MESSAGE to an SC. The PTP_FOLLOWUP_MESSAGE carries time TM1 at which the MC sends the PTP_SYNC_MESSAGE.
In Step 12, the SC receives the PTP_SYNC_MESSAGE and the PTP_FOLLOWUP_MESSAGE, records the time TS1 at which the PTP_SYNC_MESSAGE is received, and obtains the time TM1 from the PTP_FOLLOWUP_MESSAGE.
In Step 13, the SC sends a PTP_DELAY_REQ_MESSAGE to the MC at TS2.
In Step 14, the MC receives the PTP_DELAY_REQ_MESSAGE and returns a PTP_DELAY_RESP_MESSAGE, and the time TM2 at which the PTP_DELAY_REQ_MESSAGE is received is carried in the PTP_DELAY_RESP_MESSAGE.
In Step 15, the SC receives the PTP_DELAY_RESP_MESSAGE, obtains the time TM2, and calculates a DELAY from the MC to the SC.
In this step, a formula for calculating the DELAY may beDELAY=[(TM2−TS2)+(TS1−TM1)]/2=(Td1+Td3+Td4+Td4+Td2+Td1)/2,where Td1 is a delay from the MC to the OLT, Td2 is a delay from the OLT to the ONU/ONT, Td3 is a delay from the ONU/ONT to the OLT, and Td4 is a delay from the ONU/ONT to the SC. Td2+Td3 equals a logic loop delay. According to the Gigabit PON (GPON) standard, the logic loop delay is 600 μs, and the DELAY may be written asDELAY=Td1+Td4+300 μs.
In Step 16, the SC performs clock adjustment according to the calculated DELAY.
The formulas for calculating the DELAY are described in related IEEE 1588 specifications.
In the method for calculating a delay in the prior art, it is assumed that in the PTP, the delay from the MC to the SC and the delay from the SC to the MC are the same. Actually, the delay from the MC to the SC and the delay from the SC to the MC may not be the same. Therefore, the calculated delay may be inaccurate, and the time of the SC and the MC may be asynchronous.